import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:wheel_of_fortune/candy/candy_page.dart';
import 'package:wheel_of_fortune/http/wheel_server.dart';
import 'package:wheel_of_fortune/utils/utils.dart';

import 'customer_button.dart';

class NoCandy extends StatefulWidget {
  ///
  final int candyExchangeAmount;
  final rotaryTableId;
  const NoCandy(
      {this.candyExchangeAmount = 10, this.rotaryTableId = '', Key key})
      : super(key: key);

  @override
  _NoCandyState createState() => _NoCandyState();
}

class _NoCandyState extends State<NoCandy> {
  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            color: mainColor,
            child: Image.asset(
              'assets/images/messages_alerts.png',
              fit: BoxFit.fill,
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: 30, bottom: 10),
            alignment: Alignment.center,
            child: Text(
              'Insufficient Spins!',
              textAlign: TextAlign.center,
              style: TextStyle(
                color: mainColor,
                fontSize: 26,
                fontFamily: 'Avenir Next LT Pro',
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: 0, bottom: 30, left: 20, right: 20),
            alignment: Alignment.center,
            child: Column(
              children: [
                Text(
                  'You have insufficient candy,',
                  textAlign: TextAlign.center,
                  strutStyle: StrutStyle(
                      forceStrutHeight: true, height: 1, leading: 0.9),
                  style: TextStyle(
                    color: mainColor,
                    fontSize: 14,
                    fontFamily: 'Avenir Next LT Pro',
                    fontWeight: FontWeight.w400,
                  ),
                ),
                SizedBox(
                  height: 3,
                ),
                InkWell(
                  onTap: () async {
                    Fluttertoast.showToast(
                        msg: 'Developmenting', gravity: ToastGravity.CENTER);
                    // await Navigator.push(context,
                    //     MaterialPageRoute(builder: (c) {
                    //   return CandyPage();
                    // }));
                    // Navigator.of(context).pop(false);
                  },
                  child: Text(
                    'Redeem,Buy or Earn 10 candys',
                    textAlign: TextAlign.center,
                    strutStyle: StrutStyle(
                        forceStrutHeight: true, height: 1, leading: 0.9),
                    style: TextStyle(
                      color: yellowColor,
                      fontSize: 14,
                      fontFamily: 'Avenir Next LT Pro',
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                ),
                Text(
                  'for 1 spin.',
                  textAlign: TextAlign.center,
                  strutStyle: StrutStyle(
                      forceStrutHeight: true, height: 1, leading: 0.9),
                  style: TextStyle(
                    color: mainColor,
                    fontSize: 14,
                    fontFamily: 'Avenir Next LT Pro',
                    fontWeight: FontWeight.w400,
                  ),
                ),
              ],
            ),
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              BgButton(
                title: '${widget.candyExchangeAmount} candies for 1 spin!',
                width: 200.0,
                color: deepYellowColor,
                onTap: null,
              ),
              SizedBox(
                height: 20,
              ),
              InkWell(
                onTap: () => Navigator.of(context).pop(false),
                child: Text(
                  'Cancel',
                  style: TextStyle(
                    color: greyDBColor,
                    fontSize: 16,
                    fontFamily: 'Avenir Next LT Pro',
                  ),
                ),
              ),
            ],
          ),
          SizedBox(
            height: 30,
          ),
        ],
      ),
    );
  }
}
